package models

import (
	"gorm.io/gorm"
	"time"
)

type UserBasic struct {
	gorm.Model
	ID            int       `gorm:"column:id;primary_key;AUTO_INCREMENT"`
	UserName      string    `gorm:"column:user_name;type:varchar(200)"`
	Password      string    `gorm:"column:password;type:varchar(200)"`
	Phone         string    `gorm:"column:phone;type:varchar(20)"`
	Email         string    `gorm:"column:email;type:varchar(200)"`
	Identity      string    `gorm:"column:identity;type:varchar(200)"`
	ClientIP      string    `gorm:"column:client_ip;type:varchar(200)"`
	ClientPort    string    `gorm:"column:client_port;type:varchar(200)"`
	LoginTime     time.Time `gorm:"column:login_time;type:datetime(3)"`
	HeartbeatTime time.Time `gorm:"column:heartbeat_time;type:datetime(3)"`
	LogOutTime    time.Time `gorm:"column:log_out_time;type:datetime(3)"`
	IsLogout      int       `gorm:"column:is_logout;type:tinyint(1)"`
}

// IsLogout 0 登录退出 1 正常登录

const UserLogoutOn = 1
const UserLogoutOff = 0

// TableName sets the insert table name for this struct type
func (u *UserBasic) TableName() string {
	return "user_basic"
}
